//
//  TableViewModel+ViewRows.swift
//  CooperSwift
//
//  Created by 计海峰 on 2022/1/17.
//

import Foundation

// 通用 rows 的一些扩展
public extension TableViewModelProtocol {
    
    //MARK: -  默认线 cell
    func lineRow(_ height: CGFloat = 1, color: UIColor? = nil, padding: UIEdgeInsets? = nil, key: String? = nil, isTarget: Bool = true) -> TableShowViewCellModel {
        let lineConfig = TableShowBaseControlConfig().then {
            if let bgColor = color {
                $0.bgColor = bgColor
            }
            if let linePadding = padding {
                $0.padding = linePadding
            }
        }
        let lineCellModel = TableShowViewCellModel(lineConfig).then {
            $0.cellHeight = height
            if let bindKey = key {
                $0.addTargetKey(bindKey, isTarget: isTarget)
            }
        }
        return lineCellModel
    }
    
}
